package com.demon.auto.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.demon.auto.model.entity.UserClientRelationEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 用户-客户端关联
 *
 * @version 1.0
 * @author huangrz
 * @date 2025/02/13 17:04
 */
@Mapper
public interface UserClientRelationDao extends BaseMapper<UserClientRelationEntity> {

    /**
     * 删除用户客户端关联信息
     * @param clientId  客户端ID
     * @param userId    用户ID
     * @return int
     */
    @Delete("DELETE FROM t_user_client_relation WHERE client_id = #{clientId} AND user_id = #{userId}")
    int deleteByUserClientId(@Param("clientId") Long clientId, @Param("userId") Long userId);

    /**
     * 删除用户客户端所有关联信息
     * @param clientId 客户端ID
     * @return int
     */
    @Delete("DELETE FROM t_user_client_relation WHERE client_id = #{clientId}")
    int deleteUserClientAllRelation(@Param("clientId") Long clientId);

}
